home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
TSR
/
STAY50
/
MACROS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-11-17
|
4KB
|
87 lines
{ Copyright (C) 1988 Lane H. Ferris }
unit macros ;
{───────────────────────────────────────────────────────────────────}
interface
{───────────────────────────────────────────────────────────────────}
type
Vector = record { Interrupt Vector type }
ofs,Seg : word ;
end ;
Vec = vector ; { lazy Vector }
{───────────────────────────────────────────────────────────────}
{ M A C R O S Public Macros }
{───────────────────────────────────────────────────────────────}
Procedure Break; inline($cc) ; { Invoke the debugger }
Procedure NMI ; inline($CD/$02) ; { Invoke the debugger }
Procedure IncPtr(var P1; count : word) ;
{ increment a pointer or doubleword }
inline($58/ { POP AX fetch count }
$5F/ { POP DI fetch ofs }
$07/ { POP ES fetch seg }
$26/ { ES: }
$01/$05/ { ADD [DI],AX add count }
$73/$0B/ { JNB exit no ovfl }
$26/ { ES: inc segment }
$8B/$45/$02/{ MOV AX,[DI+02] }
$05/$00/$10/{ ADD AX,0100 }
$26/ { ES: }
$89/$45/$02 { MOV [DI+02],AX }
) ;
{END IncPtr}
{───────────────────────────────────────────────────────────────────}
{ M A C R O S private }
{───────────────────────────────────────────────────────────────────}
Procedure Punt ; inline($EB/$00) ; { jmp to next instruction }
Procedure EnableInterrupts ; inline($FB) ;
Procedure DisableInterrupts ; inline($FA) ;
Procedure SetSp(value:word) ; { Set StackPointer }
inline($58/$89/$C4) ; { POP AX/ MOV SP,AX }
Function GetBP : Word ; { Get Base Pointer }
inline($89/$E8) ; { MOV AX,BP }
Procedure Push(L1 :Word) ; { word already stked}
inline($90) ; { leave on stack }
Procedure Pop(var L1) ; { fetch stack word }
inline($5F/$07/ { POP DI, POP ES }
$26/$8F/$05) ; { pop ES:[DI] }
Procedure Pushflags ; { push flags on stack }
inline($9C) ; { leave on stack }
Procedure MovDS(var L1) ; { fetch stack word }
inline($5F/$07/ { POP DI, POP ES }
$26/$8E/$1D) ; { Mov DS,ES:[DI] }
Procedure SwitchToStack(stackptr : pointer ) ;
inline($FA/ { DisableInterrupts }
$5B/ { POP BX }
$17/ { POP SS }
$89/$DC/ { MOV SP,BX }
$FB/ { STI }
$89/$E5 ); { MOV BP,SP }
procedure CallFar(ProcAddr : Pointer);
inline($55/ { PUSH BP }
$89/$E5/ { MOV BP,SP }
$E8/$00/$00/ { CALL nxtinst } { get end of macro }
$5B/ { POP BX } { addr as return @ }
$81/$C3/$11/$00/ { ADD BX,0011 } { add end of macro }
$8C/$C8/ { MOV AX,CS } { retn addr to AX }
$87/$5E/$02/ { XCHG [BP+02],BX } { new rtn addr to }
$87/$46/$04/ { XCHG [BP+04],AX } { old call addr }
$5D/ { POP BP } { restore bp }
$50/ { PUSH AX } { Push far routine }
$53/ { PUSH BX } { and call it }
$CB { RETF }
) ;
{────────────────────────────────────────────────────────────────────}
implementation
begin end .